﻿using UnityEngine;
using System.Collections;

public class Timer : MonoBehaviour {

	public int levelTime = 120; //in sec
	private int restTime = 0;
	public GUIText showTime;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {

		restTime = levelTime -(int) Time.timeSinceLevelLoad ; 
		if(restTime < 0) {
			Application.LoadLevel(2);
		}
		showTime.text = restTime +"";
	}
}
